//
//  Plane.hpp
//  RayTracer
//
//  Created by 俞云康 on 3/25/16.
//  Copyright © 2016 yushroom. All rights reserved.
//

#ifndef Plane_hpp
#define Plane_hpp

#include "Shape.hpp"

//   Ax + By + Cz + D = 0
// = nP + D = 0
// (A, B, C) is normal
// if n is normalized, D is the (signed) distance from origin point to the plane
// default normal = (0, 0, 1);
class Plane : public Shape {
public:
    float3 normal;
    float D;
    
    Plane(const string& name,
          const std::shared_ptr<Transform>& transform);
    
    static shared_ptr<Shape> create(const Params& params);
    
    virtual bool intersect(const Ray& r, HitInfo* hit) const override;
    
    virtual bool intersect(const Ray& r) const override;
};


#endif /* Plane_hpp */
